home *** CD-ROM | disk | FTP | other *** search
- package views
- {
- import events.NavigationEvent;
- import flash.events.Event;
- import flash.events.MouseEvent;
- import flash.utils.getDefinitionByName;
- import model.PresentationModel;
- import mx.binding.Binding;
- import mx.binding.IWatcherSetupUtil;
- import mx.collections.ArrayCollection;
- import mx.containers.Canvas;
- import mx.controls.Alert;
- import mx.controls.Button;
- import mx.controls.Label;
- import mx.core.UIComponentDescriptor;
- import mx.core.mx_internal;
- import mx.events.PropertyChangeEvent;
- import views.Groups.PageNavigation;
-
- public class BottomNav extends Canvas
- {
- private static var _watcherSetupUtil:IWatcherSetupUtil;
-
- private var _bindings:Array;
-
- public var _bindingsByDestination:Object;
-
- [Bindable]
- private var _867085359_PageNavigation1:PageNavigation;
-
- [Bindable]
- private var _1166362513printBtn:Button;
-
- public var _bindingsBeginWithWord:Object;
-
- [Bindable]
- private var _1732660444spreadsBtn:Button;
-
- [Bindable]
- private var _1857328081presentationModel:PresentationModel;
-
- [Bindable]
- private var _681920764_Label1:Label;
-
- [Bindable]
- private var _1080376550readBtn:Button;
-
- private var _watchers:Array;
-
- [Bindable]
- private var _1880932050searchResults:ArrayCollection;
-
- [Bindable]
- private var _975152270browseBtn:Button;
-
- private var _documentDescriptor_:UIComponentDescriptor;
-
- public function BottomNav()
- {
- _documentDescriptor_ = new UIComponentDescriptor({
- "type":Canvas,
- "propertiesFactory":function():Object
- {
- return {
- "width":1280,
- "height":45,
- "childDescriptors":[new UIComponentDescriptor({
- "type":Button,
- "id":"spreadsBtn",
- "events":{"click":"__spreadsBtn_click"},
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "styleName":"bottomNavBtn",
- "label":"Spreads",
- "x":56,
- "y":0,
- "width":98,
- "height":36
- };
- }
- }),new UIComponentDescriptor({
- "type":Label,
- "id":"_Label1",
- "propertiesFactory":function():Object
- {
- return {
- "styleName":"txt",
- "x":225,
- "y":9
- };
- }
- }),new UIComponentDescriptor({
- "type":PageNavigation,
- "id":"_PageNavigation1",
- "propertiesFactory":function():Object
- {
- return {
- "x":507,
- "y":0,
- "styleName":"pageNav"
- };
- }
- }),new UIComponentDescriptor({
- "type":Button,
- "id":"readBtn",
- "events":{"click":"__readBtn_click"},
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "label":"Read",
- "styleName":"readBtn",
- "width":98,
- "height":36,
- "x":854,
- "y":0
- };
- }
- }),new UIComponentDescriptor({
- "type":Button,
- "id":"browseBtn",
- "events":{"click":"__browseBtn_click"},
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "visible":false,
- "label":"Browse",
- "styleName":"browseBtn",
- "width":111,
- "height":36,
- "x":854,
- "y":0
- };
- }
- }),new UIComponentDescriptor({
- "type":Button,
- "id":"printBtn",
- "events":{"click":"__printBtn_click"},
- "propertiesFactory":function():Object
- {
- return {
- "buttonMode":true,
- "label":"Print",
- "styleName":"printBtn",
- "width":94,
- "height":36,
- "x":1122,
- "y":0
- };
- }
- })]
- };
- }
- });
- super();
- mx_internal::_document = this;
- this.styleName = "bottomNav";
- this.width = 1280;
- this.height = 45;
- }
-
- public static function set watcherSetupUtil(param1:IWatcherSetupUtil) : void
- {
- BottomNav._watcherSetupUtil = param1;
- }
-
- private function message(param1:String) : void
- {
- Alert.show(param1,"Hint");
- }
-
- private function _BottomNav_bindingsSetup() : void
- {
- var binding:Binding = null;
- if(!_bindings)
- {
- _bindings = [];
- }
- if(!_watchers)
- {
- _watchers = [];
- }
- binding = new Binding(this,function():String
- {
- var _loc1_:* = undefined;
- var _loc2_:* = undefined;
- _loc1_ = formatIssueString(presentationModel.currentIssue);
- return _loc1_ == undefined ? null : String(_loc1_);
- },function(param1:String):void
- {
- _Label1.text = param1;
- },"_Label1.text");
- _bindings[0] = binding;
- binding = new Binding(this,function():PresentationModel
- {
- return presentationModel;
- },function(param1:PresentationModel):void
- {
- _PageNavigation1.presentationModel = param1;
- },"_PageNavigation1.presentationModel");
- _bindings[1] = binding;
- }
-
- public function __spreadsBtn_click(param1:MouseEvent) : void
- {
- clickHandler(param1);
- }
-
- [Bindable(event="propertyChange")]
- public function get printBtn() : Button
- {
- return this._1166362513printBtn;
- }
-
- public function set _PageNavigation1(param1:PageNavigation) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._867085359_PageNavigation1;
- if(_loc2_ !== param1)
- {
- this._867085359_PageNavigation1 = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_PageNavigation1",_loc2_,param1));
- }
- }
-
- public function set presentationModel(param1:PresentationModel) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1857328081presentationModel;
- if(_loc2_ !== param1)
- {
- this._1857328081presentationModel = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"presentationModel",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get _PageNavigation1() : PageNavigation
- {
- return this._867085359_PageNavigation1;
- }
-
- [Bindable(event="propertyChange")]
- public function get presentationModel() : PresentationModel
- {
- return this._1857328081presentationModel;
- }
-
- private function clickHandler(param1:Event) : void
- {
- if(-1 == presentationModel.numPages)
- {
- trace("-1 == numPages");
- message("Use \'Browse By Cover\' to choose a magazine.");
- return;
- }
- switch(param1.target)
- {
- case spreadsBtn:
- dispatchEvent(new NavigationEvent(NavigationEvent.SPREADS_TAB,null,true));
- break;
- case readBtn:
- dispatchEvent(new NavigationEvent(NavigationEvent.READ_MODE,null,true));
- readBtn.visible = false;
- browseBtn.visible = true;
- break;
- case browseBtn:
- dispatchEvent(new NavigationEvent(NavigationEvent.SPREAD_MODE,null,true));
- readBtn.visible = true;
- browseBtn.visible = false;
- break;
- case printBtn:
- dispatchEvent(new NavigationEvent(NavigationEvent.PRINT,null,true));
- }
- trace("clickHandler in BottomNav for " + param1.target);
- }
-
- [Bindable(event="propertyChange")]
- public function get spreadsBtn() : Button
- {
- return this._1732660444spreadsBtn;
- }
-
- public function set printBtn(param1:Button) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1166362513printBtn;
- if(_loc2_ !== param1)
- {
- this._1166362513printBtn = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"printBtn",_loc2_,param1));
- }
- }
-
- public function __readBtn_click(param1:MouseEvent) : void
- {
- clickHandler(param1);
- }
-
- [Bindable(event="propertyChange")]
- public function get _Label1() : Label
- {
- return this._681920764_Label1;
- }
-
- [Bindable(event="propertyChange")]
- public function get readBtn() : Button
- {
- return this._1080376550readBtn;
- }
-
- [Bindable(event="propertyChange")]
- public function get searchResults() : ArrayCollection
- {
- return this._1880932050searchResults;
- }
-
- public function __printBtn_click(param1:MouseEvent) : void
- {
- clickHandler(param1);
- }
-
- public function set spreadsBtn(param1:Button) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1732660444spreadsBtn;
- if(_loc2_ !== param1)
- {
- this._1732660444spreadsBtn = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"spreadsBtn",_loc2_,param1));
- }
- }
-
- public function set readBtn(param1:Button) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1080376550readBtn;
- if(_loc2_ !== param1)
- {
- this._1080376550readBtn = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"readBtn",_loc2_,param1));
- }
- }
-
- private function formatIssueString(param1:int) : String
- {
- trace("format issue string");
- if(null == presentationModel.monthString || null == presentationModel.yearString)
- {
- return "";
- }
- return presentationModel.monthString + " " + presentationModel.yearString;
- }
-
- public function set _Label1(param1:Label) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._681920764_Label1;
- if(_loc2_ !== param1)
- {
- this._681920764_Label1 = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"_Label1",_loc2_,param1));
- }
- }
-
- public function set searchResults(param1:ArrayCollection) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._1880932050searchResults;
- if(_loc2_ !== param1)
- {
- this._1880932050searchResults = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"searchResults",_loc2_,param1));
- }
- }
-
- private function _BottomNav_bindingExprs() : void
- {
- var _loc1_:* = undefined;
- _loc1_ = formatIssueString(presentationModel.currentIssue);
- _loc1_ = presentationModel;
- }
-
- public function __browseBtn_click(param1:MouseEvent) : void
- {
- clickHandler(param1);
- }
-
- public function set browseBtn(param1:Button) : void
- {
- var _loc2_:Object = null;
- _loc2_ = this._975152270browseBtn;
- if(_loc2_ !== param1)
- {
- this._975152270browseBtn = param1;
- dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,"browseBtn",_loc2_,param1));
- }
- }
-
- [Bindable(event="propertyChange")]
- public function get browseBtn() : Button
- {
- return this._975152270browseBtn;
- }
-
- override public function initialize() : void
- {
- var target:BottomNav = null;
- var watcherSetupUtilClass:Object = null;
- mx_internal::setDocumentDescriptor(_documentDescriptor_);
- _BottomNav_bindingsSetup();
- target = this;
- if(_watcherSetupUtil == null)
- {
- watcherSetupUtilClass = getDefinitionByName("_views_BottomNavWatcherSetupUtil");
- watcherSetupUtilClass["init"](null);
- }
- _watcherSetupUtil.setup(this,function(param1:String):*
- {
- return target[param1];
- },_bindings,_watchers);
- super.initialize();
- }
- }
- }
-
-